package com.spzx.product.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.product.api.RemoteProductService;

import com.spzx.product.api.domain.ProductSkuVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author 快点干早点散
 * @Create 2025/5/7 20:57
 * Description:
 */
@Component
@Slf4j
public class RemoteProductFallbackFactory implements FallbackFactory<RemoteProductService> {
    @Override
    public RemoteProductService create(Throwable cause) {
        log.error("获取商品SKU详情失败:{}",cause.getMessage());
        return new RemoteProductService() {
            @Override
            public R<ProductSkuVo> getProductSku(Long skuid, String header) {
                return  R.fail("获取商品SKU详情失败"+cause.getMessage());
            }
        };
    }
}
